USE `ft1`;

DROP procedure IF EXISTS `GetAllStatisticsUser`;



DELIMITER $$

USE `ft1`$$

CREATE PROCEDURE `GetAllStatisticsUser` (in p_userId bigint)

BEGIN

select "Total"as "Column", "All" as "Value",count(*) as Total from  profiles where `userId` = p_userId

union

select "gender",  `gender` , count(*) from  profiles where `userId` = p_userId  group by gender 

union 

select "isDeath",`isDeath` , count(*) from  profiles where `userId` = p_userId group by isDeath

union

select "socialStatus",  `socialStatus` , count(*) from  profiles where `userId` = p_userId group by socialStatus

union 

select "acadimicQual",`acadimicQual` , count(*) from  profiles where `userId` = p_userId group by acadimicQual

union

select "blodType",  `blodType` , count(*) from  profiles where `userId` = p_userId group by blodType 

union 

select "religion",`religion` , count(*) from  profiles where `userId` = p_userId group by religion;

END

$$



DELIMITER ;